#
# HoI - Nationalist Spain Events
#
#		written by Henrik Fhraeus
#

#########################################################################
#  Spanish Civil War - Fascist Nation
#########################################################################
event = {
	id = 3001
	random = no
	country = SPA

	trigger = {
		event = 3100
		#event = 3107
	}

	name = "EVT_3001_NAME"
	desc = "EVT_3001_DESC"
	style = 0
	picture = "SPA_fascist"

	date = { day = 17 month = july year = 1936 }
#	date = { day = 11 month = january year = 1936 }
#	offset = 3
#	deathdate = { day = 30 month = december year = 1999 }

	action_a = {
		name = "OK" # Anarchism and Communism must fall!

		command = { type = set_domestic which = democratic value = 2 }
		command = { type = set_domestic which = political_left value = 3 }

		command = { type = headofstate which = 10001 }
		command = { type = headofgovernment which = 10002 }
		command = { type = foreignminister which = 10003 }
		command = { type = armamentminister which = 10004 }
		command = { type = ministerofsecurity which = 10005 }
		command = { type = ministerofintelligence which = 10006 }
		command = { type = chiefofstaff which = 10007 }
		command = { type = chiefofarmy which = 10008 }
		command = { type = chiefofnavy which = 10009 }
		command = { type = chiefofair which = 10010 }

		command = { type = sleepminister which = 10279 } #Jos Sanjurjo as HoS
		command = { type = sleepminister which = 10281 } #Jos Sanjurjo as HoG
		command = { type = sleepminister which = 10188 } #Jos Sanjurjo as CoS
		command = { type = sleepminister which = 10211 } #Jos Sanjurjo as CoA
		command = { type = sleepleader which = 171060 }	#Sanjurjo

		command = { type = supplies value = 500 }
		command = { type = oilpool value = 2500 }
		command = { type = metalpool value = 2500 }
		command = { type = energypool value = 5000 }
		command = { type = rarematerialspool value = 2500 }

		#command = { type = trigger which = 2023 } # German intervention
		#command = { type = trigger which = 2623 } # Soviet intervention
		#command = { type = trigger which = 2801 } # French intervention
		#command = { type = trigger which = 2901 } # Italian intervention
		#command = { type = trigger which = 3400 } # UK intervention

		command = { type = add_division which = "1a Milicia Falangista" value = militia when = 0 }
		command = { type = add_division which = "2a Milicia Falangista" value = militia when = 0 }
		command = { type = add_division which = "Brigadas Navarras" value = militia when = 0 }
		command = { type = add_corps which = "Tropas de frica" value = land when = 3422 where = 347 } #Seville
		command = { type = add_division which = "Regulares Marroques" value = infantry when = 0 }
		command = { type = add_division value = militia }
		command = { type = add_division value = militia }
		command = { type = add_division value = militia }
		#command = { type = add_division value = militia }
		#command = { type = add_division value = militia }
		command = { type = add_division value = cavalry }
		command = { type = add_division which = "Requets de San Ignacio" value = cavalry when = 0 }
		command = { type = add_division value = infantry when = 0 where = artillery }
		command = { type = add_division value = infantry when = 0 }
		command = { type = add_division value = infantry }
		command = { type = convoy which = 334 value = 347 when = 16 } #Supplies to Seville
		command = { type = add_division value = transport when = 0 }
		command = { type = add_division value = transport when = 0 }
		command = { type = manpowerpool value = 500 }
	}
}

#########################################################################
#  Spanish Civil War - German Intervention
#########################################################################
event = {
	id = 3002
	random = no
	country = SPA

	# Triggered by GER 2023

	name = "EVT_3002_NAME"
	desc = "EVT_3002_DESC"
	style = 0
	picture = "SCW_German Intervention"

	action_a = {
		name = "OK" # Great!
		command = { type = supplies value = 3000 }
		command = { type = oilpool value = 200 } 
		command = { type = add_corps which = "Legin Cndor" value = air when = 3493 where = 334 } 
		command = { type = add_division which = "Bombarderos Legin Cndor" value = tactical_bomber when = 2 }
		command = { type = add_division which = "Cazas Legin Cndor" value = interceptor when = 1 }
		command = { type = add_corps which = "Legin Cndor" value = land when = 3466 where = 333 } 
		command = { type = add_division which = "Blindada Legin Cndor" value = armor when = 1 }
		command = { type = transport_pool which = SPA value = 25 }
		command = { type = gain_tech which = 1020 } #36 inf
		command = { type = gain_tech which = 9020 } #Flying circus doc
		command = { type = steal_tech which = GER }
		command = { type = steal_tech which = GER }
	}
}
#########################################################################
#  Spanish Civil War - Italian Intervention
#########################################################################
event = {
	id = 3003
	random = no
	country = SPA

	# Triggered by ITA 2901

	name = "EVT_3003_NAME"
	desc = "EVT_3003_DESC"
	style = 0
	picture = "SCW_Italian Intervention"

	action_a = {
		name = "OK" # Great!
		command = { type = manpowerpool value = 10 }
		command = { type = supplies value = 3000 }
		command = { type = oilpool value = 200 } 
		command = { type = add_division value = destroyer when = 0 }
		command = { type = add_division value = submarine when = 1 }
		command = { type = add_corps which = "Corpo Truppe Voluntario" value = land when = 3427 where = 333 }
		command = { type = add_division which = "Littorio" value = light_armor when = 0 }
		command = { type = add_division which = "Dio lo Vuole" value = infantry when = 1 }
		command = { type = add_division which = "Fiamme Nere" value = infantry when = 1 }
		command = { type = add_division which = "Penne Nere" value = infantry when = 1 }
		command = { type = add_corps which = "Aviacin Legionaria" value = air when = 1 where = 334 } 
		command = { type = add_division which = "Bombarderos Aviacin Legionaria" value = naval_bomber when = 0 }
		command = { type = add_division which = "Cazas Aviacin Legionaria" value = interceptor when = 0 }
		command = { type = transport_pool which = SPA value = 25 }
		command = { type = gain_tech which = 2320 } #Early field arty
		command = { type = steal_tech which = ITA }
#		command = { type = province_keypoints which = -1 value = 1 }
#		command = { type = province_keypoints which = -1 value = 1 }
	}
}
#########################################################################
#  Spanish Civil War - Victory!!!
#########################################################################
event = {
	id = 3004
	random = no
	country = SPA

	trigger = {
		owned = { province = 341 data = SPA }
		NOT = { 
			exists = SPR 
			event = 3108 
		}
	}

	name = "EVT_3004_NAME"
	desc = "EVT_3004_DESC"
	style = 0
	picture = "SPA_Victory"
	date = { day = 18 month = july year = 1936 }
	offset = 5
	deathdate = { day = 30 month = december year = 1999 }

	action_a = {
		name = "OK" # Great!
		command = { type = capital which = 341 }
		command = { type = set_domestic which = democratic value = 3 } 
		command = { type = set_domestic which = political_left value = 4 }
		command = { type = headofstate which = 10032 }
		command = { type = headofgovernment which = 10046 }
		command = { type = foreignminister which = 10057 }
		command = { type = armamentminister which = 10090 }
		command = { type = ministerofsecurity which = 10129 }
		command = { type = ministerofintelligence which = 10162 }
		command = { type = chiefofstaff which = 10183 }
		command = { type = chiefofarmy which = 10206 }
		command = { type = chiefofnavy which = 10230 }

#		command = { type = sleepevent which = 2155 }
#		command = { type = sleepevent which = 2156 }
		command = { type = belligerence which = SPA value = -10 }
		command = { type = relation which = POR value = 4 }
		command = { type = remove_division which = "Bombarderos Legin Cndor" value = SPA }
		command = { type = remove_division which = "Cazas Legin Cndor" value = SPA }
		command = { type = remove_division which = "Blindada Legin Cndor" value = SPA }
		command = { type = remove_division which = "Littorio" value = SPA }
		command = { type = remove_division which = "Dio lo Vuole" value = SPA }
		command = { type = remove_division which = "Fiamme Nere" value = SPA }
		command = { type = remove_division which = "Penne Nere" value = SPA }
		command = { type = remove_division which = "Bombarderos Aviacin Legionaria" value = SPA }
		command = { type = remove_division which = "Cazas Aviacin Legionaria" value = SPA }
		command = { type = remove_division which = "Viriatos" value = SPA }

		# New commands removing any surviving "Soviet" Units SPA receive through Annexion of SPR 
		command = { type = remove_division which = "Carros Soviticos" value = SPA }
		command = { type = remove_division which = "Brigadas Internacionales" value = SPA }
		command = { type = remove_division which = "Cazas soviticos" value = SPA }
		command = { type = remove_division which = "Katiuskas soviticos" value = SPA }
		# New commands removing the communist and anarchist militias if SPA gets them, when they annex SPR.
		command = { type = remove_division which = "Milicias POUM" value = SPA }
		command = { type = remove_division which = "Milicias CNT" value = SPA }
		# Remove GER & ITA logistic support
		command = { type = transport_pool which = SPA value = -50 }

		command = { type = sleepleader which = 171013 } # Annibale Bergonzoli ITA
		command = { type = sleepleader which = 171016 } # Cavalcanti - seems to be spanish
		command = { type = sleepleader which = 171027 } # Gastone Gambara ITA
		command = { type = sleepleader which = 171055 } # Mario Roatta ITA
		command = { type = sleepleader which = 171066 } # Hellmuth Volkmann GER
		command = { type = sleepleader which = 171092 } # Rudolf von Moreau GER
		command = { type = sleepleader which = 171093 } # von Richthofen GER
		command = { type = sleepleader which = 171094 } # Sperrle GER
		command = { type = sleepleader which = 171096 } # Eoin O'Duffy IRE
		command = { type = sleepminister which = 10269 } # Rudolf von Moreau GER

		command = { type = sleepevent which = 3108 } # Repuplican SCW win event
		command = { type = sleepevent which = 2662 } # USSR SCW Victory event
		command = { type = sleepevent which = 2803 } # France SCW Victory event
		command = { type = sleepevent which = 3901 } # UK SCW Victory event
	}
}

#########################################################################
#  Germany pressures Franco over Gibraltar
#########################################################################
event = {
	id = 3005
	random = no
	country = SPA

	#triggered by GER 2036 

	name = "EVT_3005_NAME"
	desc = "EVT_3005_DESC"
	style = 0
	picture = "SPA_Franco_Axis"
	
	action_a = {
		name = "ACTIONNAME3005A"
		ai_chance = 90
		command = { type = alliance which = GER }
		command = { type = relation which = GER value = 50 } # Undo effects of pressure
	}
	action_b = {
		name = "ACTIONNAME3005B"
		ai_chance = 10
		command = { type = trigger which = 2037 } # GER
	}
}

#########################################################################
#  Spanish Civil War - Intervention by Portugal
#########################################################################
event = { 
	id = 3006
	random = no
	country = POR
	
	trigger = {
		government = fascist
		war = { country = SPA country = SPR }
		event = 3100 #SPA fascist nation
		supplies = 200 # 100 left
		manpower = 10 # 0 left
		NOT = {
			OR = {
				war = { country = POR country = SPA }
				war = { country = POR country = GER }
				war = { country = POR country = ENG }
				war = { country = POR country = ITA }
			}
		}
	}
	
	name = "EVT_3006_NAME"
	desc = "EVT_3006_DESC"
	style = 0
	picture = "Portugal"

	date = { day = 19 month = july year = 1936 }
	offset = 5
	deathdate = { day = 29 month = december year = 1999 }
	
	action_a = {
		name = "ACTIONNAME3006A" # Send materiel and volunteers
		ai_chance = 95
		command = { type = relation which = SPA value = 15 }
		command = { type = relation which = SPR value = -15 }
		command = { type = relation which = FRA value = -3 }
		command = { type = relation which = ENG value = -3 }
		command = { type = relation which = SOV value = -3 }
		command = { type = relation which = GER value = 3 }
		command = { type = relation which = ITA value = 3 }
		command = { type = manpowerpool value = -10 }
		command = { type = supplies value = -100 } 
		command = { type = free_supplies value = -4 }
		command = { type = trigger which = 3007 value = 100 }
		command = { type = trigger which = 3008 } #SPA
		command = { type = belligerence which = POR value = 1 }
	}
	action_b = {
		name = "ACTIONNAME3006B" # Franco needs no aid
		ai_chance = 5
		command = { type = dissent value = 5 }
		command = { type = relation which = SPA value = -15 }
		command = { type = relation which = SPR value = 15 }
		command = { type = relation which = FRA value = 3 }
		command = { type = relation which = ENG value = 3 }
		command = { type = relation which = SOV value = 3 }
		command = { type = relation which = GER value = -3 }
		command = { type = relation which = ITA value = -3 }
		command = { type = domestic which = interventionism value = -1 }
		command = { type = belligerence which = POR value = -1 }
		command = { type = sleepevent which = 3009 }
	}
}

event = {
	id = 3007
	random = no
	country = POR

	name = "EVT_3006_NAME"
	desc = "EVT_3006_DESC"
	style = 0
	picture = "Portugal"

	action_a = {
		name = "OK"
		command = { type = free_supplies value = 4 }
	}
}

#########################################################################
#  Spanish Civil War - Portuguese  Intervention
#########################################################################
event = {
	id = 3008
	random = no
	country = SPA

	# Triggered by POR 3006

	name = "EVT_3008_NAME"
	desc = "EVT_3008_DESC"
	style = 0
	picture = "portuguese_volunteers"

	action_a = {
		name = "OK" # Great!
		command = { type = supplies value = 500 }		
#		command = { type = manpowerpool value = 10 }
		command = { type = add_division which = "Viriatos" value = infantry when = 0 }
#		command = { type = transport_pool which = SPA value = 5 }

	}
}

#########################################################################
#  Spanish Civil War ends - Viriatos returns home
#########################################################################
event = {
	id = 3009
	random = no
	country = POR

	trigger = {
		government = fascist
		event = 3006 # POR intervention happened
		OR = {
			event = 3004 # Spanish Civil War - Victory!!! i.e. 'Nationalists win event' has triggered
			AND = {
				flag = SCW_allied_intervention	# If allies intervene then it doesnt matter which side wins
				event = 3108
				NOT = { exists = SPA }
			}
		}
		NOT = {
			war = { country = POR country = SPA }
			war = { country = POR country = SPR }
			war = { country = POR country = SOV }
			war = { country = POR country = ENG }
			war = { country = POR country = USA }
		}
	}

	name = "EVT_3009_NAME"
	desc = "EVT_3009_DESC"
	style = 0
	picture = "portuguese_volunteers"

	date = { day = 18 month = july year = 1936 }
	offset = 5
	deathdate = { day = 29 month = december year = 1999 }

	action_a = {
		name = "ACTIONNAME3009A" # Great! 
		command = { type = relation which = SPA value = 20 } # Franco is pleased
		command = { type = manpowerpool value = 5 }	# Heroes return home - after heavy casualties
		command = { type = gain_tech which = -2 } # Equals "event 1012: Accidental discovery. Miracular breaktrough in research"
	}
}

#  Spanyol polgrhbor - Magyar beavatkozs
#########################################################################
event = {
	id = 90160
	random = no
	country = SPA

	# Triggered by HUN 90159

	name = "EVT_90160_NAME"
	desc = "EVT_90160_DESC"
	style = 0
	picture = "SCW_Italian Intervention"

	action_a = {
		name = "ACTIONNAME90160A" # Great!
		command = { type = manpowerpool value = 4 }
		command = { type = supplies value = 100 }
	}
}

#  Kk hadosztly
#########################################################################
event = {
	id = 91251
	random = no
	country = SPA

	trigger = {
		exists = GER 
		OR = {
			headofstate = 10032
			headofgovernment = 10046
		}
		war = { country = GER country = SOV }
		event = 2034   #condor lgi hazatrse
	}

	name = "EVT_91251_NAME"
	desc = "EVT_91251_DESC"
	style = 0
	picture = "kekhadosztaly"

	date = { day = 23 month = june year = 1941 }
	offset = 10 
	deathdate = { day = 30 month = december year = 1964 }

	action_a = {
		name = "ACTIONNAME91251A" 
		command = { type = manpowerpool value = -18 }
		command = { type = setflag which = divisionazul }	
		command = { type = domestic which = interventionism value = 1 }
		command = { type = relation which = GER value = 10 }
		command = { type = relation which = SOV value = -10 }
	}
	action_b = {
		name = "ACTIONNAME91251B" 
		command = { type = dissent value = -1 } #elg a harcbl
		command = { type = relation which = GER value = -20 }
	}
}
